<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24/024
 * Time: 20:12
 */

namespace app\admin\validate;

class SignSetValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加参数
    const SCENE_EDIT = 'edit'; //编辑参数
    const SCENE_REMOVE = 'remove'; //删除参数


    protected $rule = [
        'id' => 'require|number',
        'title'  =>  'require|max:32',
        'sign_key'  =>  'require|max:32',
        'gold'  =>  'require|number',
    ];


    protected $message  = [
        'id.require' => '类型必须',
        'id.number' => '必须为数字',
        'title.require' => '名称必须',
        'title.max' => '名称最大32位',
        'sign_key.require' => '关键字必须',
        'sign_key.max' => '关键字最大32位',
        'gold.require' => '金币数必须',
        'gold.number' => '金币最大32位',
    ];
    
    //场景
    protected $scene  = [
       self::SCENE_ADD => ['title', 'sign_key', 'gold'],
       self::SCENE_EDIT => ['id', 'title', 'sign_key', 'gold'],
       self::SCENE_REMOVE => ['id'],
    ];


}